<script setup>
import ActivityItem from "@/views/Activity/components/ActivityItem.vue";
import { allActivityAPI } from '@/apis/activity'
import { ref, onMounted } from "vue";

const activityList = ref([])
const getActivityList = async () => {
    const res = await allActivityAPI()
    activityList.value = res.rows
    console.log(activityList.value)
    
}

onMounted(() => getActivityList())
</script>
<template>
    <div class="activity-index-wrap" style="min-height: 1432px">
        <div class="main-content">
            <div class="activity-filter"></div>
            <div class="activity-list-wrap">
                <div class="oh-wrap">
                    <ActivityItem v-for="activity in activityList" :key="activity.id" :activeId="activity.id"
                        :title="activity.title" :state="activity.state">
                        <img :src="activity.imgShow" :alt="activity.title">
                    </ActivityItem>
                </div>
            </div>
        </div>
    </div>
</template>
<style scoped lang="scss">
.activity-index-wrap {
    position: relative;
    font-family: Arial, PingFang-SC-Regular, Microsoft yahei, "\5FAE\8F6F\96C5\9ED1", Hiragino Sans GB, tahoma, STHeiTi, "\5B8B\4F53", sans-serif;
    background: #f4f4f5;
}

.activity-index-wrap .main-content {
    min-height: 300px;
    width: 1200px;
    margin: 0 auto;
}

.activity-list-wrap {
    width: 1200px;
    margin: 60px 0 30px;
}

.activity-list-wrap .oh-wrap {
    width: 1218px;
}

.activity-list-wrap .list-item.top-list-item {
    width: 1198px;
    height: 322px;
    padding-left: 712px;
    margin: 0 18px 30px 0;
    cursor: default;
}

.activity-list-wrap .list-item {
    position: relative;
    float: left;
    width: 386px;
    height: 326px;
    margin: 0 18px 20px 0;
    background-color: #fff;
    cursor: pointer;
    border: 1px solid #f2f3f5;
}

.activity-list-wrap .list-item.top-list-item .fav-img {
    width: 680px;
    height: 320px;
    position: absolute;
    left: 0;
    top: 0;
}

.activity-list-wrap .list-item.top-list-item .fav-wrap {
    padding: 0 20px 0 0;
}

.fav-title {
    font-size: 24px;
    line-height: 25px;
    padding: 40px 0;
}

.activity-list-wrap .list-item {
    font-size: 16px;
    line-height: 20px;
    color: #1b2939;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    padding-top: 18px;
    padding-bottom: 8px;
}

.activity-list-wrap .list-item.top-list-item .fav-url {
    padding-bottom: 26px;
}

.fav-url .ant-btn {
    width: 160px;
    height: 42px;
    background: #fabe00;
    color: #fff;
    font-size: 14px;
    border: none;
}

.ant-btn,
.ant-btn:active,
.ant-btn:focus {
    outline: 0;
}

.ant-btn {
    line-height: 1.5715;
    position: relative;
    display: inline-block;
    font-weight: 400;
    white-space: nowrap;
    text-align: center;
    background-image: none;
    box-shadow: 0 2px 0 rgba(0, 0, 0, .015);
    cursor: pointer;
    transition: all .3s cubic-bezier(.645, .045, .355, 1);
    user-select: none;
    touch-action: manipulation;
    height: 32px;
    padding: 4px 15px;
    font-size: 14px;
    border-radius: 2px;
    color: rgba(0, 0, 0, .85);
    border: 1px solid #d9d9d9;
    background: #fff;
}

.fav-state {
    position: absolute;
    top: 0;
    left: 0;
    width: 80px;
    height: 42px;
    line-height: 20px;
    text-align: center;
    color: #fff;
}

.activity-list-wrap .list-item .fav-state.bluebg {
    background: #377aea;
}</style>